/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package edu.cmu.mism.dgjava.data.models.option.util;

import edu.cmu.mism.dgjava.data.models.option.*;

import java.util.List;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;

/**
 * <!-- begin-user-doc -->
 * The <b>Switch</b> for the model's inheritance hierarchy.
 * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
 * to invoke the <code>caseXXX</code> method for each class of the model,
 * starting with the actual class of the object
 * and proceeding up the inheritance hierarchy
 * until a non-null result is returned,
 * which is the result of the switch.
 * <!-- end-user-doc -->
 * @see edu.cmu.mism.dgjava.data.models.option.OptionModelPackage
 * @generated
 */
public class OptionModelSwitch<T> {
	/**
	 * The cached model package
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected static OptionModelPackage modelPackage;

	/**
	 * Creates an instance of the switch.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public OptionModelSwitch() {
		if (modelPackage == null) {
			modelPackage = OptionModelPackage.eINSTANCE;
		}
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	public T doSwitch(EObject theEObject) {
		return doSwitch(theEObject.eClass(), theEObject);
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	protected T doSwitch(EClass theEClass, EObject theEObject) {
		if (theEClass.eContainer() == modelPackage) {
			return doSwitch(theEClass.getClassifierID(), theEObject);
		}
		else {
			List<EClass> eSuperTypes = theEClass.getESuperTypes();
			return
				eSuperTypes.isEmpty() ?
					defaultCase(theEObject) :
					doSwitch(eSuperTypes.get(0), theEObject);
		}
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	protected T doSwitch(int classifierID, EObject theEObject) {
		switch (classifierID) {
			case OptionModelPackage.DERIVITIVES: {
				Derivitives derivitives = (Derivitives)theEObject;
				T result = caseDerivitives(derivitives);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case OptionModelPackage.EQUITY: {
				Equity equity = (Equity)theEObject;
				T result = caseEquity(equity);
				if (result == null) result = caseDerivitives(equity);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case OptionModelPackage.CURRENCY: {
				Currency currency = (Currency)theEObject;
				T result = caseCurrency(currency);
				if (result == null) result = caseDerivitives(currency);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case OptionModelPackage.INDEX: {
				Index index = (Index)theEObject;
				T result = caseIndex(index);
				if (result == null) result = caseDerivitives(index);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case OptionModelPackage.FUTURES: {
				Futures futures = (Futures)theEObject;
				T result = caseFutures(futures);
				if (result == null) result = caseDerivitives(futures);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case OptionModelPackage.PRICING_MODEL: {
				PricingModel pricingModel = (PricingModel)theEObject;
				T result = casePricingModel(pricingModel);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case OptionModelPackage.EUROPEAN_TYPE: {
				EuropeanType europeanType = (EuropeanType)theEObject;
				T result = caseEuropeanType(europeanType);
				if (result == null) result = casePricingModel(europeanType);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case OptionModelPackage.AMERICAN_TYPE: {
				AmericanType americanType = (AmericanType)theEObject;
				T result = caseAmericanType(americanType);
				if (result == null) result = casePricingModel(americanType);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case OptionModelPackage.BINOMIAL_EUROPEAN: {
				BinomialEuropean binomialEuropean = (BinomialEuropean)theEObject;
				T result = caseBinomialEuropean(binomialEuropean);
				if (result == null) result = caseEuropeanType(binomialEuropean);
				if (result == null) result = casePricingModel(binomialEuropean);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case OptionModelPackage.BINOMIAL_AMERICAN: {
				BinomialAmerican binomialAmerican = (BinomialAmerican)theEObject;
				T result = caseBinomialAmerican(binomialAmerican);
				if (result == null) result = caseAmericanType(binomialAmerican);
				if (result == null) result = casePricingModel(binomialAmerican);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case OptionModelPackage.OPTION_CALCULATION_RESULT: {
				OptionCalculationResult optionCalculationResult = (OptionCalculationResult)theEObject;
				T result = caseOptionCalculationResult(optionCalculationResult);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case OptionModelPackage.MONTE_CARLO_SIMULATION: {
				MonteCarloSimulation monteCarloSimulation = (MonteCarloSimulation)theEObject;
				T result = caseMonteCarloSimulation(monteCarloSimulation);
				if (result == null) result = caseEuropeanType(monteCarloSimulation);
				if (result == null) result = casePricingModel(monteCarloSimulation);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case OptionModelPackage.IMPLICIT_FINITE_DIFFERENCE: {
				ImplicitFiniteDifference implicitFiniteDifference = (ImplicitFiniteDifference)theEObject;
				T result = caseImplicitFiniteDifference(implicitFiniteDifference);
				if (result == null) result = caseAmericanType(implicitFiniteDifference);
				if (result == null) result = casePricingModel(implicitFiniteDifference);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case OptionModelPackage.BLACK_SCHOLES: {
				BlackScholes blackScholes = (BlackScholes)theEObject;
				T result = caseBlackScholes(blackScholes);
				if (result == null) result = caseEuropeanType(blackScholes);
				if (result == null) result = casePricingModel(blackScholes);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			default: return defaultCase(theEObject);
		}
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Derivitives</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Derivitives</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseDerivitives(Derivitives object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Equity</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Equity</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseEquity(Equity object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Currency</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Currency</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseCurrency(Currency object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Index</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Index</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseIndex(Index object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Futures</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Futures</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseFutures(Futures object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Pricing Model</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Pricing Model</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T casePricingModel(PricingModel object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>European Type</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>European Type</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseEuropeanType(EuropeanType object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>American Type</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>American Type</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseAmericanType(AmericanType object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Binomial European</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Binomial European</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseBinomialEuropean(BinomialEuropean object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Binomial American</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Binomial American</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseBinomialAmerican(BinomialAmerican object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Option Calculation Result</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Option Calculation Result</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseOptionCalculationResult(OptionCalculationResult object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Monte Carlo Simulation</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Monte Carlo Simulation</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseMonteCarloSimulation(MonteCarloSimulation object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Implicit Finite Difference</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Implicit Finite Difference</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseImplicitFiniteDifference(ImplicitFiniteDifference object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>Black Scholes</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>Black Scholes</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseBlackScholes(BlackScholes object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch, but this is the last case anyway.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject)
	 * @generated
	 */
	public T defaultCase(EObject object) {
		return null;
	}

} //OptionModelSwitch
